package ModelLayer;
import java.util.ArrayList;

/**
 * Write a description of class DVDcontainer here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DVDcontainer
{
    // instance variables - replace the example below with your own
    private ArrayList<DVD> d;
    private static DVDcontainer instance;
    
     public DVDcontainer()
    {
                d = new ArrayList<DVD>();
    }
    
    //Singleton
    public static DVDcontainer getInstance()
    {
        if(instance == null)
        {
            instance = new DVDcontainer();
        }
        return instance;
    }
    
    public void addDVD(DVD dvd)
    {
        d.add(dvd);
    }
    
      public void sletDVD(DVD dvd)
    {
        d.remove(dvd);
    }
    
     public DVD findDVD(int id)
    {
    for (int i=0; i<this.d.size(); i++)
    {
        DVD dvd = this.d.get(i);
        if (dvd.getId() == id)
        {
             return dvd;
        }
    }
    return null; // no Customer found with this ID; maybe throw an exception
   }
}
